Skip to content

fix: guard against nil keyboard-shortcut in register-action!#85

Merged
ericdallo merged 3 commits into
clojure-lsp:masterfrom
joao-pgarcia:master
May 6, 2026
Merged

fix: guard against nil keyboard-shortcut in register-action!#85
ericdallo merged 3 commits into
clojure-lsp:masterfrom
joao-pgarcia:master

Conversation

@joao-pgarcia

Copy link
Copy Markdown
Contributor

Problem

On IntelliJ startup, the plugin throws a PluginException wrapping a NullPointerException because the doseq loop in RegisterActionsStartup iterates over clojure-lsp-commands and passes :keyboard-shortcut keyboard-shortcut unconditionally to action/register-action!. Commands that don't define a keyboard shortcut (most of them) have nil here, which violates IntelliJ's @NotNull contract on KeymapImpl.addShortcut.

Fixes #84

Solution

Wrap the call with apply and use cond-> to only include :keyboard-shortcut in the args vector when it is non-nil:

(apply action/register-action!
  (cond-> [:id ... :title text ...]
    keyboard-shortcut (conj :keyboard-shortcut keyboard-shortcut)))

This way commands without a shortcut are still registered correctly, and KeymapImpl.addShortcut is never called with a nil shortcut.

@ericdallo ericdallo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@ericdallo ericdallo merged commit cd9162f into clojure-lsp:master May 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PluginException: NullPointerException in KeymapImpl.addShortcut during startup (register_actions_startup)

2 participants